# Configuration Options: https://docs.mongodb.org/manual/reference/configuration-options/
# Log Messages/Components: https://docs.mongodb.com/manual/reference/log-messages/index.html

systemLog:
  destination: file
  logAppend: true
  path: {{ log_file }}

{% if cluster_role == 'shard' or cluster_role == 'config' or cluster_role == 'replicaSet' %}
storage:
  dbPath: {{ storage_path }}
  
{% endif %}

{% if replica_set is defined and replica_set.name is defined %}
replication:
  replSetName: {{ replica_set.name }}
  oplogSizeMB: {{ mongodb_oplog_size }}
{% endif %}
{% if cluster_role == 'shard' %}
sharding:
  clusterRole: shardsvr
{% endif %}
{% if cluster_role == 'config' %}
sharding:
  clusterRole: configsvr
{% endif %}
{% if cluster_role == 'router' and config_db %}
sharding:
  configDB: {{ config_db }}
{% endif %}

{% if configuring_replica_set is not defined or not configuring_replica_set %}
security:
{% if cluster_role != 'router' %}
  authorization: enabled
{% endif %}
  keyFile: {{ keyfile_path }}
{% endif %}

# network interfaces
net:
  port: {{ rs_port }}
  bindIp: 127.0.0.1,{{ ansible_host }}
